<template>
  <div class="leftContainer">
    <div class="leftContainer-point">
      <div class="leftContainer-point-titleBgc">
        <div class="leftContainer-point-titleBgc-leftText">今日安全指数</div>
      </div>
      <div class="leftContainer-point-content">
        <div class="leftContainer-point-content-secure">
          <div style="height: 140px;display: flex;flex-direction: column;justify-content: space-between;">
            <div>
              <span style="font-size: 32px;color: #FFFFFF;">90</span>
              <span>分</span>
            </div>
            <div>
              <span>风险监控</span>
              <span style="margin-left: 14px;color: #FFFFFF;font-size: 18px;">0</span>
            </div>
            <div>
              <span>风险监控</span>
              <span style="margin-left: 14px;color: #FFFFFF;font-size: 18px;">0</span>
            </div>
            <div>
              <span>火灾风险</span>
              <span style="margin-left: 14px;color: #FFFFFF;font-size: 18px;">0</span>
            </div>
          </div>
          <div style="width: 200px;height: 166px;" ref="changeEchart">

          </div>
        </div>

      </div>
    </div>
    <div class="leftContainer-environment">
      <div class="leftContainer-environment-titleBgc">
        <div class="leftContainer-environment-titleBgc-leftText">消防安全执行</div>
      </div>
      <div class="leftContainer-environment-content">
        <div class="leftContainer-environment-content-dayBox">2</div>
        <div class="leftContainer-environment-content-dayBox">2</div>
        <div class="leftContainer-environment-content-dayBoxs">天</div>
      </div>
    </div>
    <div class="leftContainer-realTime">
      <div class="leftContainer-realTime-titleBgc">
        <div class="leftContainer-realTime-titleBgc-leftText">实时开关量状态</div>
      </div>
      <div class="leftContainer-realTime-content">
        <div class="leftContainer-realTime-content-text">
          <div>火警（FAS-烟雾报警器）主控楼 伏龙火灾报警主机_办公室吊顶内烟感火警状态</div>
          <div style="color: rgba(255,255,255,0.7);">2023-4-10 12:12:14</div>
        </div>
        <div class="leftContainer-realTime-content-text">
          <div>FAS-手动报警器 屏蔽【主控楼 伏龙火灾报警主机_极2阀冷却设备室手报屏蔽状态】</div>
          <div style="color: rgba(255,255,255,0.7);">2023-7-21 16:25:45</div>
        </div>
        <div class="leftContainer-realTime-content-text">
          <div>ONL-直流电源投入【极Ⅱ高端换流变区域，极二高排油】</div>
          <div style="color: rgba(255,255,255,0.7);">2023-11-06 9:43:52</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import "echarts-liquidfill";
// import * as echarts from "echarts/core";
import * as echarts from "echarts";
import wenImage from "../../assets/images/home/icon_wen.png";
import capacityImage from "../../assets/images/home/icon_capacity.png";
import rateImage from "../../assets/images/home/icon_rate.png";
import tempImage from "../../assets/images/home/icon_temp.png";
import wetImage from "../../assets/images/home/icon_wet.png";
import stressImage from "../../assets/images/home/icon_stress.png";
import loadImage from "../../assets/images/home/icon_load.png";
const changeEchart = ref(null);
const initNobodyEcharts = () => {
  const myEchart = echarts.init(changeEchart.value);
  let option = myEchart.getOption();
  if (option != null) {
    myEchart.clear();
    myEchart.setOption(option);
  }
  var value = '75';
  var subtext = `样本量：2233`;
  var max = 100;
  option = {
    title: {
      show: true,
      text: value || '仪表盘',

      textAlign: 'center',

      subtextStyle: {
        align: 'center',
        fontSize: 20,
        left: 0,
        color: '#7f7f7f',
      },
      left: 95,
      bottom: 60,
      textStyle: {
        color: '#37A2DA',
        fontSize: 24,
        align: 'center',
        textAlign: 'center',
        fontFamily: '"Microsoft Yahei","微软雅黑"',
      },
    },
    angleAxis: {
      axisLine: {
        show: false,
      },
      axisLabel: {
        show: false,
      },
      splitLine: {
        show: false,
      },
      axisTick: {
        show: false,
      },
      min: 0,
      max: 132,
      // boundaryGap: ['0', '10'],
      startAngle: 225,
    },
    radiusAxis: {
      type: 'category',
      axisLine: {
        show: false,
      },
      axisTick: {
        show: false,
      },
      axisLabel: {
        show: false,
      },
      data: ['a', 'b', 'c'],
      z: 10,
    },
    polar: {
      radius: '105%',
    },
    series: [
      // 粉色圆
      {
        type: 'bar',
        data: [, , value],
        z: 1,
        coordinateSystem: 'polar',
        barMaxWidth: 12,
        name: '警告事件',
        roundCap: true,
        color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
          {
            offset: 0,
            color: '#00C0FF',
          },
          {
            offset: 1,
            color: '#DFF7FF',
          },
        ]),
        barGap: '-100%',
      },
      // 灰色的圆
      {
        type: 'bar',
        data: [0, 0, max],
        z: 0,
        silent: true,
        coordinateSystem: 'polar',
        barMaxWidth: 12,
        name: 'C',
        roundCap: true,
        color: '#F1F3F5',
        barGap: '-100%',
      },
      // 里面刻度
      {
        type: 'gauge',
        radius: '85%',
        splitNumber: 2,
        max: max,

        detail: {
          show: false,
        },
        axisLine: {
          // 坐标轴线
          lineStyle: {
            // 属性lineStyle控制线条样式
            width: 3,
            opacity: 0, //刻度背景宽度
          },
        },
        splitLine: {
          show: false,
          length: 6, //长刻度节点线长度
        },
        axisTick: {
          show: true,
          lineStyle: {
            width: 2,
            color: '#00C0FF',
          },
          length: 6,
          splitNumber: 10,
        },
        axisLabel: {
          show: false,
        },
        pointer: {
          show: false,
        },
      },
    ],
    tooltip: {
      show: false,
    },
  };

  myEchart.setOption(option);
}
const loadData = ref([
  {
    url: loadImage,
    name: "2.409",
    unit: 'mw',
    text: "实时负荷",
  },
  {
    url: wenImage,
    name: "37.59",
    unit: '℃',
    text: "实时油温",
  },
  {
    url: capacityImage,
    name: "49.0",
    unit: 'mw',
    text: "额定容量",
  },
  {
    url: rateImage,
    name: "4.81",
    unit: '%',
    text: "负载率",
  },
]);
const envData = ref([
  {
    url: tempImage,
    name: "18.6",
    unit: "℃",
    text: "环境温度",
  },
  {
    url: wetImage,
    name: "53",
    unit: "RH",
    text: "环境湿度",
  },
  {
    url: stressImage,
    name: "96.400",
    unit: 'kPa',
    text: "大气压力",
  },
]);
onMounted(() => {
  initNobodyEcharts()
})
</script>

<style lang="scss" scoped>
.leftContainer {
  display: flex;
  position: absolute;
  left: 17px;
  flex-direction: column;
  padding-top: 37px;
  z-index: 99;
  pointer-events: all;

  &-point {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* 水平居中 */
    cursor: pointer;
    width: 411px;
    height: 235px;
    background-image: url("../../assets/images/home/bg_emphasis.png");
    background-size: 100% 100%;

    &-titleBgc {
      width: 393px;
      height: 37px;
      background-image: url("../../assets/images/home/bg_emphasisTit.png");
      background-size: 100% 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 14px;

      &-leftText {
        font-size: 20px;
        font-family: AlibabaPuHuiTi-2-65-Medium;
        font-weight: 400;
        background: linear-gradient(180deg, #DFF7FF 0%, #00C0FF 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        margin-left: 53px;
        margin-bottom: 15px;
      }

      &-rightText {
        font-size: 14px;
        font-family: Alibaba PuHuiTi 2-55 Regular, Alibaba PuHuiTi 20;
        font-weight: normal;
        color: rgba(255, 255, 255, 0.7);

      }
    }

    &-content {
      // width: calc(100% - 88px);
      // height: calc(100% - 44px - 70px);
      width: 411px;
      height: 235px;
      margin-top: 20px;
      /* 垂直居中 */
      display: flex;
      justify-content: space-between;

      &-secure {
        width: calc(100% - 42px);
        height: 147px;
        margin: 0 auto;
        display: flex;
        justify-content: space-between;
        font-size: 14px;
        font-family: Alibaba PuHuiTi 2.0, Alibaba PuHuiTi 20;
        font-weight: normal;
        color: rgba(255, 255, 255, 0.7);
      }


    }
  }

  &-environment {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* 水平居中 */
    cursor: pointer;
    width: 411px;
    height: 155px;
    background-image: url("../../assets/images/home/bg_emphasis.png");
    background-size: 100% 100%;
    margin-top: 32px;

    &-titleBgc {
      width: 393px;
      height: 37px;
      background-image: url("../../assets/images/home/bg_emphasisTit.png");
      background-size: 100% 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 14px;

      &-leftText {
        font-size: 20px;
        font-family: AlibabaPuHuiTi-2-65-Medium;
        font-weight: 400;
        line-height: 23px;
        background: linear-gradient(180deg, #DFF7FF 0%, #00C0FF 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        margin-left: 53px;
        margin-bottom: 15px;
      }

      &-rightText {
        font-size: 14px;
        font-family: Alibaba PuHuiTi 2-55 Regular, Alibaba PuHuiTi 20;
        font-weight: normal;
        color: rgba(255, 255, 255, 0.7);
      }
    }

    &-content {
      width: calc(100% - 32px);
      height: calc(100% - 44px - 64px);
      margin-top: 26px;
      /* 垂直居中 */
      display: flex;
      /* 水平两端对齐 */
      align-items: flex-start;

      &-dayBox {
        width: 38px;
        height: 44px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 4px 4px 4px 4px;
        font-size: 22px;
        font-family: Alibaba PuHuiTi 2.0, Alibaba PuHuiTi 20;
        font-weight: normal;
        color: #FFFFFF;
        line-height: 44px;
        text-align: center;
        margin-left: 4px;
      }

      &-dayBoxs {
        width: 38px;
        height: 44px;
        font-size: 14px;
        font-family: Alibaba PuHuiTi 2.0, Alibaba PuHuiTi 20;
        font-weight: normal;
        color: rgba(255, 255, 255, 0.7);
        text-align: center;
        line-height: 44px;
      }

    }
  }

  &-realTime {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* 水平居中 */
    cursor: pointer;
    width: 411px;
    height: 418px;
    background-image: url("../../assets/images/home/bg_emphasis.png");
    background-size: 100% 100%;
    margin-top: 32px;

    &-titleBgc {
      width: 393px;
      height: 37px;
      background-image: url("../../assets/images/home/bg_emphasisTit.png");
      background-size: 100% 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 14px;

      &-leftText {
        font-size: 20px;
        font-family: AlibabaPuHuiTi-2-65-Medium;
        font-weight: 400;
        line-height: 23px;
        background: linear-gradient(180deg, #DFF7FF 0%, #00C0FF 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        margin-left: 53px;
        margin-bottom: 15px;
      }

      &-rightText {
        font-size: 14px;
        font-family: Alibaba PuHuiTi 2-55 Regular, Alibaba PuHuiTi 20;
        font-weight: normal;
        color: rgba(255, 255, 255, 0.7);
      }
    }

    &-content {
      width: 385px;
      height: 324px;

      margin-top: 26px;
      /* 垂直居中 */
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      /* 水平两端对齐 */
      align-items: flex-start;

      &-text {
        width: 100%;
        height: 108px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
        font-size: 14px;
        font-family: Alibaba PuHuiTi 2.0, Alibaba PuHuiTi 20;
        font-weight: normal;
        color: #DFF7FF;
        line-height: 22px;
        margin-top: 19px;
      }
    }
  }
}
</style>